<?php
class Model_staff extends CI_Model
{
	function tampilData()
	{
		$query=$this->db->get('staff');
		if($query->num_rows()>0)
		{
			return $query->result();
		}
		else
		{
			return array();
		}
	}

	function tambah($data)
	{
		$tambah=$this->db->insert('staff',$data);
		return $tambah;
	}

	function per_id($id)
	{
		$this->db->where('nip',$id);
		$query=$this->db->get('staff');
		return $query->result();
	}

	function hapus($id)
	{
		$this->db->where('nip',$id);
		$hapus = $this->db->delete('staff');
		return $hapus;
	}

	function update($id, $data)
	{
		$this->db->where('nip',$id);
		$update = $this->db->update('staff',$data);
		return $update;
	}
}
?>